﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using FarseerGames.FarseerPhysics.Dynamics;

namespace UnitLibrary.GameObjects.Physics
{
        public class PhyBody
        {
            public string Name = "Brutal";
            public float Mass = 1;
            public float MomentOfInertia = 1;
            public bool IsStatic = false;
            public Vector2 Position = Vector2.Zero;
            public float Rotation = 0f;
            public float AngularVelocity = 0;
            public bool Enabled = true;
            public bool IgnoreGravity = false;
            public bool IsQuadraticDragEnabled = false;
            public float LinearDragCoefficient = 0.001f;
            public Vector2 LinearVelocity = Vector2.Zero;
            public float QuadraticDragCoefficient = 0.001f;
            public float RotationalDragCoefficient = 0.001f;
            public float IdleTime = 0f;
            public bool IsAutoIdle = false;
            public float MinimumVelocity = 55;

            /// <summary>
            /// Copy values from this object into a reference of an existing body.
            /// </summary>
            /// <param name="body"></param>
            public void CopyValues(ref Body body)
            {
                body.Mass = this.Mass;
                body.MomentOfInertia = this.MomentOfInertia;
                body.IsStatic = this.IsStatic;
                body.Position = this.Position;
                body.Rotation = this.Rotation;
                body.AngularVelocity = this.AngularVelocity;
                body.Enabled = this.Enabled;
                body.IgnoreGravity = this.IgnoreGravity;
                body.IsQuadraticDragEnabled = this.IsQuadraticDragEnabled;
                body.LinearDragCoefficient = this.LinearDragCoefficient;
                body.LinearVelocity = this.LinearVelocity;
                body.QuadraticDragCoefficient = this.QuadraticDragCoefficient;
                body.RotationalDragCoefficient = this.RotationalDragCoefficient;
                body.IdleTime = this.IdleTime;
                body.IsAutoIdle = this.IsAutoIdle;
                body.MinimumVelocity = this.MinimumVelocity;
            }

            public void CopyValues(ref PhyBody body)
            {
                body.Mass = this.Mass;
                body.MomentOfInertia = this.MomentOfInertia;
                body.IsStatic = this.IsStatic;
                body.Position = this.Position;
                body.Rotation = this.Rotation;
                body.AngularVelocity = this.AngularVelocity;
                body.Enabled = this.Enabled;
                body.IgnoreGravity = this.IgnoreGravity;
                body.IsQuadraticDragEnabled = this.IsQuadraticDragEnabled;
                body.LinearDragCoefficient = this.LinearDragCoefficient;
                body.LinearVelocity = this.LinearVelocity;
                body.QuadraticDragCoefficient = this.QuadraticDragCoefficient;
                body.RotationalDragCoefficient = this.RotationalDragCoefficient;
                body.IdleTime = this.IdleTime;
                body.IsAutoIdle = this.IsAutoIdle;
                body.MinimumVelocity = this.MinimumVelocity;
            }
        }
    }

